@isTest

private class CaseNoAutoReplyTriggerTester 
{
    public static testMethod void testCaseNoAutoReply()
    {
        ID IOGIncident_CASE_RecordType = RecordTypeHelper.GetRecordTypeID('Case', 'IOG Incident');
        
        // add 'blacklisttest@emailvelocityignore.com' to the blacklist, which should unconditionally
        // set the NoAutoReplyDate__c field on any case with SuppliedEmail = 'blacklisttest@emailvelocityignore.com'
        EmailVelocityIgnoreHandler.enable('noreply@abc.com', 'blacklisttest@emailvelocityignore.com', 0);
        
        
        // now create just such a case
        Case c = new Case();
        c.Subject = 'emailvelotriggertest';
        c.Origin = 'Email';
        c.Status = 'Open';
        c.IR_Priority__c = 'Standard';
        c.CSS_CRF_RequestType__c = 'Change Task';
        c.RecordTypeId = IOGIncident_CASE_RecordType;
        c.SuppliedEmail = 'blacklisttest@emailvelocityignore.com';
        insert c;
        
        // and verify:
        list<case> cs = [select id, NoAutoReplyDate__c from case where SuppliedEmail = 'blacklisttest@emailvelocityignore.com'];
        system.assertNotEquals(cs[0].NoAutoReplyDate__c, null);
        
        // add 'caseautoclosetest@caseblacklist.com' to the case blacklist, which should unconditionally
        // set the Status field on any case with SuppliedEmail = 'caseautoclosetest@caseblacklist.com'
        CaseBlacklistHandler.add('caseautoclosetest@caseblacklist.com');
        CaseBlacklistHandler.edit('caseautoclosetest@caseblacklist.com', true, true, true);
        
         // now create just such a case
        Case c2 = new Case();
        c2.Subject = 'caseautoclosetriggertest';
        c2.Origin = 'Email';
        c2.Status = 'Open';
        c2.IR_Priority__c = 'Standard';
        c2.CSS_CRF_RequestType__c = 'Change Task';
        c2.RecordTypeId = IOGIncident_CASE_RecordType;
        c2.SuppliedEmail = 'caseautoclosetest@caseblacklist.com';
        insert c2;
        
        // and verify:
        cs = [select id, Status from case where SuppliedEmail = 'caseautoclosetest@caseblacklist.com'];
        system.assertEquals(cs[0].Status, 'Closed');
        
    }
}